package edu.city.class_2201_sno_202212008.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;

import java.util.ArrayList;
import java.util.List;

import edu.city.class_2201_sno_202212008.Domain.QuestionModel;
import edu.city.class_2201_sno_202212008.R;
import edu.city.class_2201_sno_202212008.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {
    private ActivityMainBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
        );

        binding.singleBtn.setOnClickListener(v -> {
            Intent intent = new Intent(MainActivity.this, QuestionActivity.class);
            intent.putParcelableArrayListExtra("list", new ArrayList<>(questionList()));
            startActivity(intent);
        });

        binding.bottomMenu.setItemSelected(R.id.home, true);
        binding.bottomMenu.setOnItemSelectedListener(itemId -> {
            if (itemId == R.id.Board) {
                startActivity(new Intent(MainActivity.this, LeaderActivity.class));
            }
            return null;
        });
    }

    private List<QuestionModel> questionList() {
        List<QuestionModel> question = new ArrayList<>();
        question.add(new QuestionModel(1, "Which planet is the larget plant in the solar system?", "Earth", "Mars", "Neptune", "Jupiter", "d", 5, "q_1", null));
        question.add(new QuestionModel(2, "Which country is the larget country in the world by land area?", "Russia", "Canada", "United States", "China", "a", 5, "q_2", null));
        question.add(new QuestionModel(3, "Which of  the folowing substances is use as an anti-cancer medication inthe medical world?", "Cheese", "Lemon juice", "Cannabis", "Paspalum", "c", 5, "q_3", null));
        question.add(new QuestionModel(4, "Which moon in the Earth's solar system has an atmosphere?", "Lune(Moon)", "Phobos(Mars' moon)", "Venus' moon", "None of the above", "d", 5, "q_4", null));
        question.add(new QuestionModel(5, "Which of the following symbols represents the chemical element with the atomic number 6?", "Q", "H", "C", "N", "c", 5, "q_5", null));
        question.add(new QuestionModel(6, "Who is credited with inviting theater as we know it today?", "Shakespeare", "Arthur Miller", "Ashkouri", "Ancient Greeks", "d", 5, "q_6", null));
        question.add(new QuestionModel(7, "Which ocean is the largest ocean in the world?", "Pacific Ocean", "Atlantic Ocean", "Indian Ocean", "Arctic Ocean", "a", 5, "q_7", null));
        question.add(new QuestionModel(8, "Which religions are among the most practiced religions in the world?", "Islam, Christianity, Judaism", "Buddhism, Hinduism, Sikhism", "Zoroastrianism,Brahmanism,Yazdenism", "Taoism,shintoism,Confucianism", "a", 5, "q_8", null));
        question.add(new QuestionModel(9, " In Which continent are the most independent countries located?", "Asia", "Europe", "Africa", "Americas", "c", 5, "q_9", null));
        question.add(new QuestionModel(10, "Which ocean has the greatest average depth?", "Pacific Ocean", "Atlantic Ocean", "Indian Ocean", "Southern Ocean", "d", 5, "q_10", null));
        return question;
    }
} 